<template>
  <div class="aside-list">
    <div
      class="aside-list-item"
      v-for="(item, index) in catList"
      :key="index"
      :class="[
        activeTab == index ? 'active' : '',
        index == activeTab + 1 ? 'top-raduis' : '',
        index == activeTab - 1 ? 'bottom-raduis' : '',
      ]"
      @click="activeTab = index"
    >
      <div class="item-content">
        <span v-if="index == activeTab" class="item-active-line"></span>
        <span class="item-text">{{ item.name }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    propsData: {
      type: Object,
      default: {},
    },
    catList: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  mixins: [],
  components: {},
  data() {
    return {
      dataList: [
        {
          text: "推荐分类",
        },
        {
          text: "精选超市",
        },
        {
          text: "家电",
        },
      ],
      activeTab: 0,
    };
  },
  mounted() {
    this.$nextTick(() => {
      console.log(this.catList, "cat");
    });
  },
  watch: {},
  computed: {},
  methods: {},
};
</script>

<style lang="scss" scoped>
.aside-list {
  width: 100%;
  background: #f2f2f2;
  .aside-list-item {
    width: 100%;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    .item-content {
      width: 100%;
      height: 100%;
      background-color: #f2f2f2;
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
    }
    .item-text {
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: 400;
      color: #262626;
      height: 20px;
      line-height: 20px;
    }
  }
  .active {
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 600;
    color: #262626;

    .item-content {
      background: #ffffff;
    }
    .item-active-line {
      width: 3px;
      height: 16px;
      background: #f0250e;
      position: absolute;
      left: 10px;
      top: 15px;
      z-index: 1;
    }
  }
  .top-raduis {
    background-color: #ffffff;
    .item-content {
      border-radius: 0 10px 0 0;
    }
  }
  .bottom-raduis {
    background-color: #ffffff;
    .item-content {
      border-radius: 0 0 10px 0;
    }
  }
}
</style>
